1. Field of the Invention
The present invention relates to a communication technology and, more particularly, to a technology for efficiently processing a packet, a technology for efficiently processing data communication using a plurality of communication protocols and a technology for calculating a checksum of a packet transmitted or received over a network.
2. Description of the Related Art
With the contemporary widespread use of the Internet and on-going improvement in network infrastructure, much attention is drawn to Internet phone apparatuses capable of transmitting and receiving data packets obtained by coding a speech audio signal over a network such as the Internet. An Internet phone apparatus may be used as a video phone apparatus by transmitting video images concurrently with speech audio. Accordingly, Internet phone apparatuses are expected to replace existing telephone apparatuses to become next-generation telephone apparatuses.
Currently, Transmission Control Protocol/Internet Protocol (TCP/IP) is widely used as a communications protocol for packet communication. TCP is a communications protocol that places importance on accuracy by, for example, transmitting and receiving data only when connection between apparatuses is established. However, the orthodox approach involves complex processes and accompanied by timing-related constraints in which subsequent packets cannot be sent unless reception of a given packet is acknowledge by the party at the other end of the line. Due to a lack in real-time response, the orthodox approach is not suitable for transmission and reception of speech audio.
User Datagram Protocol/Internet Protocol (UDP/IP) is known as a communications protocol simpler than TCP. In UDP, it is not necessary to establish connection between apparatuses prior to data transmission and reception. Since there is no need to wait for acknowledgement of packets to send subsequent packets, the transmitting end is permitted to send packets on a continuous basis. For this reason, the protocol is suitable for transmission and reception of speech audio in which real-time response is more appreciated than data accuracy.
In apparatuses that support both TCP and UDP, packets are generally subject to software processes that use a general-purpose processor such as a CPU. More specifically, when a network interface device receives packets, packets addressed to Media Access Control (MAC) addresses other than that of the apparatus to which the device is connected are filtered out. The packets that passed the subsequent error check using Cyclic Redundancy Check (CRC) are sent to the CPU for processing.
Problems with an approach in which the entirety of packets are subject to software processes using the CPU are, for example, poor processing efficiency, low speed and large power consumption. Especially, in speech communication with a plurality of parties or in transmission of images in addition to audio, real-time response suffers since protocol-related processes determine the processing speed. Since the CPU continues to execute protocol-related processes during speech communication, it is difficult to execute other applications concurrently. When a high-performance apparatus with a CPU installed such as a personal computer is used for communication, no serious problem arises as a result of the CPU taking care of the entire packet-related processes, since the performance of such an apparatus matches the required task. In developing an apparatus dedicated to Internet phone, there is no other choice but to install a CPU of relatively low performance in order to meet requirements for miniaturization, low cost and low power consumption of the apparatus. Accordingly, a task to be challenged is to reduce the processing load imposed on a CPU. Increasing the performance of a CPU for improvement in processing speed results in an increase in the cost, power consumption and generated heat. Therefore, a compromise solution must be found by sacrificing some of the requirements.
In some apparatuses such as network routers, in which high-speed is demanded, the entirety of protocol-related processes are hardware implemented. In an approach in which both protocols are processed by hardware, high-speed protocol-related processes are possible. There are problems, however, in that the circuit scale, cost, power consumption and generated heat are increased as a result of hardware implementation of complex TCP-related processes.
In TCP and UDP, data are packetized before transmission and reception. In order to check the integrity of received data, each packet is assigned a checksum. A checksum is a result of one's complement addition of the entire packet data and is stored in a header of a packet. The transmitting end calculates a sum of the entire packet data prior to transmission so as to calculate a checksum, which is then stored in a header for transmission. The receiving end receiving the packet calculates a sum of the entire packet data and checks whether the result matches the checksum stored in the header. If they match, the receiving end determines that the packet reception is successful. If they do not, the receiving end determines that there is an error in the received packet and discards the packet.
In the case of TCP, the amount of data that can be transmitted in one session varies depending on the status of network and of a buffer at the receiving end. The amount of data transmitted is determined-immediately prior to transmission. For this reason, the transmitting end reads out packet data to be transmitted and calculates a checksum only after the size of that data is determined. The checksum is then stored in the packet header. After the header information is transmitted, subsequent data are read out and transmitted.
Japanese Laid-Open Patent Publication No. 2001-268159 discloses a method for generating TCP packets. In this method, data transmitted using TCP are stored in a TX buffer. When the size of packet to be transmitted is determined, data of that size are read out from the TX buffer and a checksum is calculated. The data thus read out is stored in a temporary buffer. After the header that includes the checksum is transmitted, the data are read out from the temporary buffer and transmitted. By providing two memories, data read-out from the TX buffer for checksum calculation and data read-out from the temporary buffer for data transmission can take place concurrently. Pipelining of the read-out operations facilitates improvement in overhead.
Even with this approach, however, a problem remains in that a checksum is calculated only after the size of packet to be transmitted is determined and a relatively long delay occurs before the packet is transmitted. Another problem is that, since two memories physically separate from each other are necessary, the hardware scale and manufacturing cost are increased.